package io.github.doc.action.language;

import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiJavaFile;
import io.github.doc.action.language.visitor.JavaFileVisitor;
import io.github.doc.action.language.visitor.Visitor;

/**
 * <p>Company: 深圳振瀚信息技术有限公司成都分公司 </p>
 * <p>Description: </p>
 *
 * @author ZH.Team
 * @version 1.0.0
 * @email "mailto:ZH.Team@zhxx.com"
 * @date 2025.01.05 16:59
 * @since y.y.y
 */
public class VisitorFactory {

    /**
     * Gets psi file visitor *
     *
     * @param file file
     * @return the psi file visitor
     * @since y.y.y
     */
    public static Visitor<?, ?> getPsiFileVisitor(PsiFile file) {
        if (file instanceof PsiJavaFile) {
            return new JavaFileVisitor(file.getProject());
        }
        throw new UnsupportedOperationException();
    }
}
